﻿using Ducu.GLB.Global;
using Ducu.GLB.Global.Story;
using Ducu.SRV.ServiceInteface;
using Ducu.SRV.ViewModel.Shared;
using Ducu.SRV.ViewModel.Task;
using Ducu.SRV.ViewModel.Task.Shared;
using System;
using System.Collections.Generic;
using Story = Ducu.GLB.Global.Story;

namespace Ducu.SRV.UIDevService
{
    public class TaskService : ITaskService
    {
        public FulfilModel GetFulfil(int planId)
        {
            return new FulfilModel
            {
                //Title = new NameIdModel
                //{
                //    Id = Plan.ID_VOA,
                //    Name = Plan.TITLE_VOA
                //},
                //Description = Plan.DESCRIPTION_VOA
            };
        }

        public IList<_DayModel> GetWeekChart(int planId)
        {
            if (planId == Plan.ID_RUN)
            {
                return new List<_DayModel>
                {
                    new _DayModel
                    { 
                        CompleteDate = DateTime.Now.AddDays(-4), 
                        Status = Status.NotComplte
                    },
                    new _DayModel
                    { 
                        CompleteDate = DateTime.Now.AddDays(-3), 
                        Status = Status.Accepted
                    },
                    new _DayModel
                    { 
                        CompleteDate = DateTime.Now.AddDays(-2), 

                        Status = Status.WaitComplete
                    },                    
                    new _DayModel
                    { 
                        CompleteDate = DateTime.Now.AddDays(-1), 
                        Status = Status.WaitComplete
                    },                    
                    new _DayModel
                    { 
                        CompleteDate = DateTime.Now, 
                        Status = Status.WaitComplete
                    },                    
                    new _DayModel
                    { 
                        CompleteDate = DateTime.Now.AddDays(1), 
                        Status = Status.Future
                    },                    
                    new _DayModel
                    { 
                        CompleteDate = DateTime.Now.AddDays(2), 
                        Status = Status.Rest
                    }

                };
            }


            return new List<_DayModel>
            {
                new _DayModel
                { 
                    CompleteDate = DateTime.Now.AddDays(-4), 
                    Status = Status.NotComplte
                },
                new _DayModel
                { 
                    CompleteDate = DateTime.Now.AddDays(-3), 
                    Status = Status.Accepted
                },
                new _DayModel
                { 
                    CompleteDate = DateTime.Now.AddDays(-2), 

                    Status = Status.Refused
                },                    
                new _DayModel
                { 
                    CompleteDate = DateTime.Now.AddDays(-1), 
                    Status = Status.WaitAccept
                },                    
                new _DayModel
                { 
                    CompleteDate = DateTime.Now, 
                    Status = Status.WaitComplete
                },                    
                new _DayModel
                { 
                    CompleteDate = DateTime.Now.AddDays(1), 
                    Status = Status.Future
                },                    
                new _DayModel
                { 
                    CompleteDate = DateTime.Now.AddDays(2), 
                    Status = Status.Rest
                }

            };
        }

        public _TaskItemModel GetAccept(int planId)
        {
            return new _TaskItemModel
                {
                    Id = Story.Task.ID_VOA_1,
                    Comment = Story.Task.COMMENT_VOA_1,
                    CompleteDate = Story.Task.COMPLETE_VOA_1,

                };
        }

        public IList<_TaskItemModel> GetNeedAccept()
        {
            return new List<_TaskItemModel>
            {
                new _TaskItemModel
                { 
                    Id = Plan.ID_READING, 
                    //Name = Plan.TITLE_READING, 
                    //TaskId = Story.Task.ID_READING_1
                },
                new _TaskItemModel
                {
                    Id = Plan.ID_VOA,
                    //Name = Plan.TITLE_VOA, 
                    //TaskId = Story.Task.ID_VOA_1                          
                }
            };
        }


        public void Fulfil(FulfilModel model, int planId)
        {
        }


        public void DoAccept(AcceptModel model)
        {
            throw new NotImplementedException();
        }


        public HistoryListModel GetHistoryList(int planId, Pager pager)
        {
            throw new NotImplementedException();
        }


        public int GetCount(int planId)
        {
            throw new NotImplementedException();
        }


        public IList<_TaskItemModel> GetNeedAccept(int planId)
        {
            throw new NotImplementedException();
        }


        public HistoryMonthModel GetHistoryMonth(int planId, int year, int month)
        {
            HistoryMonthModel model = new HistoryMonthModel
            {
                Items = new List<_DayModel>()
            };
            for (int i = 0; i < 35; i++)
            {
                model.Items.Add(new _DayModel
                {
                    CompleteDate = DateTime.Now.AddDays(-i),
                    Status = Status.Accepted
                });
            }
            return model;
        }


        public HistoryListItemModel GetHistoryItem(int taskId)
        {
            throw new NotImplementedException();
        }


        public void Reply(int taskId, string content, bool applyAccept)
        {
            throw new NotImplementedException();
        }


        public _TaskItemModel Get(int taskId)
        {
            throw new NotImplementedException();
        }


        public void Leave(_TaskItemModel model, int planId)
        {
            throw new NotImplementedException();
        }
    }
}
